package com.woniu.function.controller;


import com.woniu.entity.Result;
import com.woniu.function.entity.DTO.RescueDTO;
import com.woniu.function.service.IFunctionService;
import com.woniu.function.service.IIllegallyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/function")
@Api(tags = "常用功能")
public class FunctionController {

    @Autowired
    IFunctionService functionService;
    @Autowired(required = false)
    IIllegallyService illegallyService;

    @ApiOperation("保养")
    public Result nurse(){
        return null;
    }


    @ApiOperation("美容")
    public Result beautify(){
        return null;
    }

    @ApiOperation("换轮胎")
    public Result changeTire(){
        return null;
    }

    @ApiOperation("加油")
    @GetMapping("/oil/{phone}/{storeServiceId}")
    public Result oil(@PathVariable("phone") String phone,@PathVariable("storeServiceId") String storeServiceId){
        return functionService.oil(phone,storeServiceId);
    }

    @ApiOperation("救援")
    @PostMapping("/rescue")
    public Result rescue(@RequestBody RescueDTO rescueDTO){
        return functionService.rescue(rescueDTO);
    }

    @ApiOperation("违章")
    @GetMapping("/illegally/{userId}/{carId}")
    public Result illegally(@PathVariable("userId") String userId ,@PathVariable("carId") String carId){
        return illegallyService.selectIllegally(userId,carId);
    }



}
